#include "GenericButton.h"
#include "InputHandler.h"
#include "Defines.h"

GenericButton::GenericButton(const LoadedParams* Param, std::string text) : AnimatedGraphic(Param, 1, 1), mText(text), clicked(false)
{
}


GenericButton::~GenericButton(void)
{
}

void GenericButton::Draw()
{
	AnimatedGraphic::Draw();
}

void GenericButton::Update()
{
	Vector2D* pMousePos = InputHandler::Instance()->getMousePosition();

	if(pMousePos->getX() < (position.getX() + Width) 
	&& pMousePos->getX() > position.getX()
	&& pMousePos->getY() < (position.getY() + Height) 
	&& pMousePos->getY() > position.getY())
	{
		if(InputHandler::Instance()->Clicked())
			clicked = true;
		else
			clicked = false;
	}

	AnimatedGraphic::Update();
}

void GenericButton::Shutdown()
{
	AnimatedGraphic::Shutdown();
}
